{% extends "base.html" %}
{% load static %}
{% block pagetitle %} Account Activation {% endblock %}
{% block title %} Account Activation {% endblock %}
{% block nav %}
<div class="container-fluid">
    <nav class="navbar navbar-expand-sm navbar-dark bg-primary fixed-top">
        <a class="navbar-brand" href="{% url 'yaksh:index' %}">
        <img src="{% static 'yaksh/images/yaksh_banner.png' %}" alt="YAKSH">
        </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarColor01">
        <ul class="navbar-nav ml-auto">
            <li class="nav-item dropdown my-lg-0" style="font-size: 1.2rem">
                <a class="dropdown-toggle nav-link" id="user_dropdown" data-toggle="dropdown" href="#">{{user.get_full_name|title}}
                </a>
                <div class="dropdown-menu dropdown-menu-right">
                    <a class="dropdown-item" id="user_logout" href="{% url 'yaksh:logout' %}">
                        <i class="fa fa-sign-out"></i> Logout
                    </a>
                </div>
            </li>
        </ul>
        </div>
    </nav>
</div>
{% endblock %}
{% block content %}
<div class="container">
    {% if success %}
        <center>
        <div class="alert alert-success" role="alert">
            <strong> {{ msg }} </strong>
        </div>
        <a href="{% url 'yaksh:index' %}"> Home </a>
        </center>
    {% else %}
        {% if msg %}
            <center>
            <div class="alert alert-warning" role="alert">
                <strong> {{ msg }} </strong>
            </div>
            </center>
            <center>
                <div class="col-md-6">
                    <form action="{% url 'yaksh:new_activation' %}" method="post">
                    {% csrf_token %}
                    <input type="email" name="email" class="form-control" placeholder="Email address" required><br><br>
                    <button class="btn btn-success btn-lg" type="submit">Send Email</button>
                    </form>
                </div>
            </center>
        {% endif %}
    {% endif %}
    <br/>
    {% if activation_msg %}
        <center>
        <div class="alert alert-info" role="alert">
            <strong> {{ activation_msg }} </strong>
        </div>
        <a href="{% url 'yaksh:index' %}"> Home </a>
        </center>
    {% endif %}

    {% if email_err_msg %}
        <center>
        <div class="alert alert-warning" role="alert">
            <strong> {{ email_err_msg }} </strong>
        </div>
        </center>
        <center>
            <div class="col-md-6">
                <form action="{% url 'yaksh:update_email' %}" method="post">
                {% csrf_token %}
                    <input type="text" name="username" required placeholder="Username" class="form-control" />
                    <br>
                    <input type="email" name="email" required placeholder="New email address" class="form-control" />
                <br>
                <button class="btn btn-success btn-lg" type="submit">Submit</button>
                </form>
            </div>
        </center>
    {% endif %}
</div>
{% endblock content %}
